using UnityEngine;
using System.Collections;

/// <summary>
/// Classe utilizada no Shotting.
/// </summary>
public class Shotting : MonoBehaviour {
	
	public Rigidbody bullet;
	public float speed = 20;
	public Transform explosion;	private Rigidbody bulletInstantiated = null; 
		
	void Update () {
		
		if((Input.GetButtonDown("Jump")) && (bulletInstantiated == null))
		{
			bulletInstantiated = Instantiate(bullet, 			// o objeto para ser instanciado
														transform.position, // a posicao no plano 3D
														transform.rotation) // a rotacao do objeto
														as Rigidbody;		// um Castingo para converter para o Rigibody
			
			// move o objeto
			bulletInstantiated.velocity = transform.TransformDirection(new Vector3(0,0,speed));
			
			audio.Play();
			
		}
	
	}
	
	
	
}
